<?php
/**
 * TinyMVC - Database.class.php file 
 * 
 * @author Adrian Wieczorek <adi(at)tinymvc(dot)org>
 * @package TinyMVC
 * @subpackage Database
 * @version $Id: Database.class.php 3 2007-09-11 12:08:07Z adi3ek $
 * 
 */

/**
	* database access singleton class
	* @package TinyMVC
 */
abstract class Database {
	static private $instance = null;

	private function __construct() {
	}

	private function __clone() {
	}

	/**
	 * get instance of db access class
	 * @param mixed database driver (only at first call)
	 * @return mixed database driver
	 */
	static public function getInstance($driver = null) {
 	if(self::$instance == null) {
			if($driver == null) {
				throw new TinyMVCException('database driver in null');
			}
			else	{
				self::$instance = $driver;				
			} 
		}
		return self::$instance;
	}
	
}
